package com.cskaoyan.controller;

import com.cskaoyan.bean.Admin;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("admin/admin")
public class AdminController {

    @Autowired
    AdminService adminService;

    @RequestMapping("list")
    public BaseRespVo list() {
        List<Admin> admins = adminService.list();
        return BaseRespVo.ok(admins);
    }
    @RequestMapping("update")
    public BaseRespVo update(Integer id,Integer[] roleIds) {
        adminService.update(id, roleIds);
        return BaseRespVo.ok();
    }
}
